package sip

import (
	"sync"
)

/*
	    入参：
	    1：接受到的message 实体
		2:是否方法内自己发送

		出参：
		1：返回内容
		2：错误信息
		3：下一步调用方法
*/
type MessageHandler func(m *Message, network string, remoteIp string, remotePort int) error

var (
	MessageHandlerMap                = make(map[string]MessageHandler)
	MessageQueryCmdTypeHandlerMap    = make(map[string]MessageHandler)
	MessageResponseCmdTypeHandlerMap = make(map[string]MessageHandler)
	MessageNotifyCmdTypeHandlerMap   = make(map[string]MessageHandler)

	ChanMap = make(map[string]chan any)
	mutex   sync.Mutex
)

func PutChanMap(key string, value chan any) {
	mutex.Lock()
	ChanMap[key] = value
	mutex.Unlock()
}

func RemoveChanMap(key string) {
	mutex.Lock()
	delete(ChanMap, key)
	mutex.Unlock()
}

func HandleMethod() {

	initAckHandlerMap()
}
